public class Solution {
    public int NumberOf1(int n) {
        int ret = 0;

        for (int i = 0; i < 32; i++) {
            System.out.println(n & (1 << i));
            if ((n & (1 << i)) != 0) {
                ret++;
            }
        }

        return ret;
    }
}

/*
public class Solution {
    public int NumberOf1(int n) {
        int ans = 0;
        while (n != 0) {
            ans += (n & 1);
            n >>>= 1;
        }
        return ans;
    }
}
*/